home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 5 / Amiga Plus Sonderheft 1996 #5.iso / programme / visual / rexx / imagefx1.5.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-08  |  2KB  |  115 lines

  1. /*
  2.  * $VER: 1.00 (2-mar-1995)
  3.  *
  4.  * Arexx program for Visual to generate thumbnails with ImageFX.
  5.  * Written by C.Vallee
  6.  *
  7.  * This script generates thumbnails for all the selected file
  8.  *
  9.  */
  10.  
  11. options results
  12. gfxport = IMAGEFX.1
  13.  
  14. /* Loading ImageFX, if not present */
  15.  
  16. if (~show('p',gfxport)) then do
  17.    message "Loading ImageFX..."
  18.    address command "run ImageFX:ImageFX Iconify"
  19.    message "Waiting for the "||gfxport||" ARexx port..."
  20. end
  21.  
  22.  
  23. /* Waiting for the ARexx port every 2 seconds until present
  24.    do while (~show('p','IMAGEFX.1'))
  25.       address command "Wait 2"
  26.       check
  27.       if rc ~= 0 then exit
  28.    end
  29. end
  30. */
  31.  
  32. /*
  33.  
  34. GetInfo
  35. parse var result '"' mypalette '"' w h .
  36.  
  37. address value gfxport
  38.  
  39. Redraw Off
  40. Undo Off
  41.  
  42. Render Mode Hires Lace Ham
  43. Render Colors 64
  44.  
  45. LockRange 0 Off
  46. Palette 8
  47. LoadPalette '"'mypalette'"' '-1'
  48. LockRange 0 On
  49.  
  50. address
  51.  
  52. do forever
  53.    check
  54.    if rc ~= 0 then break
  55.  
  56.    getselected
  57.    if result = "" then break
  58.    file = result
  59.  
  60.    i = LASTPOS('/', file)
  61.    IF i = 0 THEN i = LASTPOS(':', file)
  62.    name = substr( file , i+1 )
  63.  
  64.    message 'Loading "'||name||'"...' 
  65.  
  66.    address
  67.    LoadBuffer '"'file'"' Force NoSmooth
  68.  
  69.    if rc = 0 then do
  70.       GetMain
  71.       parse var result . width height .
  72.  
  73.       if ( width * h ) > (height * w ) then do
  74.          height = ( height * w ) % width
  75.          width = w
  76.       end
  77.       else do
  78.          width = ( width * h ) % height
  79.          height = h
  80.       end
  81.  
  82.       address VISUAL message 'Scaling "'||name||'"...'
  83.  
  84.       Scale width height
  85.       Grey2Color
  86.  
  87.       address VISUAL message 'Rendering "'||name||'"...'
  88.  
  89.       Render Go
  90.  
  91.       SaveRenderedAs ILBM '"'file'.icn"'
  92.  
  93.       Render Close
  94.     
  95.       KillBuffer Force
  96.  
  97.       address
  98.       update
  99.       end
  100.    else do
  101.       address
  102.       unselect
  103.    end
  104. end
  105.  
  106. address
  107.  
  108. Undo On
  109. Redraw On
  110.  
  111. */
  112.  
  113. /* Quit ImageFX
  114. Quit force
  115. */